﻿import wikiviewer.Controllers


registry["wikilist"] = WikiListFormatter()
registry["wikitable"] = WikiTableFormatter()


#crop annotations
wiki """^(\s*\#[^\r\n]+[\r\n]+)+""", ""
#crop wikitoc
wiki """<wiki:toc[\s\S]+?>""", ""
#headers
wiki """(?m)^\s*=\s+([^\r\n]+?)\s+=\s*$""","<h1>$1</h1>"
wiki """(?m)^\s*==\s+([^\r\n]+?)\s+==\s*$""","<h2>$1</h2>"
wiki """(?m)^\s*===\s+([^\r\n]+?)\s+===\s*$""","<h3>$1</h3>"
wiki """(?m)^\s*====\s+([^\r\n]+?)\s+====\s*$""","<h4>$1</h4>"
wiki """(?m)^\s*=====\s+([^\r\n]+?)\s+=====\s*$""","<h4>$1</h4>"

#links
wiki """\[(\w+)\]""","<a href='$1.wiki'>$1</a>"
wiki """\[(\w+)\s([\s\S]+?)\]""","<a href='$1.wiki'>$2</a>"
#bolders
wiki """\*(\S[\s\S]+?\S)\*""","<strong>$1</strong>"